<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<div class="span8 offset2">
    <form class="form-horizontal well" method="POST" action="MainServlet?action=bus.model.save">
        <fieldset>
            <legend>Edit bus model</legend>
            <div class="hidden">
                <input type="hidden" name="id" value="<c:out value="${busModel.getId()}" />" >
            </div>                    

            <div class="control-group">
                <label class="control-label" for="modelName">Model name:</label>
                <div class="controls">
                    <input class="myinput" type="text" id="modelName" name="modelName" value="<c:out value="${busModel.getModelName()}" />">
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="vehicleType">Vehicle type:</label>
                <div class="controls">
                    <select class="myinput" id="vehicleType" name="vehicleType">
                        <c:forEach var="vehicleType" items="${vehicleTypeList}">
                            <c:choose>
                                <c:when test="${vehicleType != busModel.getVehicleType()}">
                                    <option value="<c:out value="${vehicleType.toString()}" />"><c:out value="${vehicleType.toString()}" /></option>
                                </c:when>
                                <c:when test="${vehicleType == busModel.getVehicleType()}">
                                    <option selected="true" value="<c:out value="${vehicleType.toString()}" />"><c:out value="${vehicleType.toString()}" /></option>
                                </c:when>
                            </c:choose>
                        </c:forEach>
                    </select>
                </div>
            </div>

            <div class="form-actions">
                <input type="submit" class="btn btn-primary" name="saveButton" value="Save bus model data">
                <button class="btn" id="cancelButton" name="cancelButton" data-button-to-click="cancelButtonOutOfForm">Cancel</button>
            </div>
                
        </fieldset>
    </form>
                
                
    <button class="btn" id="cancelButtonOutOfForm" data-link="bus-model-list" style="display: none; visibility: hidden; height: 0px; width: 0px;">Cancel</button>
</div>